package com.kh.pajx.sop.dao.impl;

import java.util.List;

import org.springframework.stereotype.Repository;

import com.kh.pajx.sop.base.BaseDaoImpl;
import com.kh.pajx.sop.dao.IStockDevDao;
import com.kh.pajx.sop.domain.stock.StockDev;
import com.kh.pajx.sop.domain.stock.StockDevInDetail;
import com.kh.pajx.sop.domain.stock.StockDevOutDetail;
@Repository
public class StockDevDaoImpl extends BaseDaoImpl<StockDev> implements IStockDevDao{

	@Override
	public List<StockDev> getByName(String devName) {
		String hql="from StockDev s where 1=1 and s.devName='"+devName+"'";
		return getSession().createQuery(hql).list();
	}

	@Override
	public List<StockDev> getByDev(StockDevInDetail detail) {
		// TODO Auto-generated method stub
		String hql="from StockDev s where 1=1 and s.devName=? and s.devVer=? and s.devSupplierId=?";
		return getSession().createQuery(hql).setParameter(0, detail.getDevName())
				.setParameter(1, detail.getDevVer()).setParameter(2,detail.getDevSupplierId()).list();
	}
	
	@Override
	public List<StockDev> getByDev(StockDevOutDetail detail) {
		// TODO Auto-generated method stub
		String hql="from StockDev s where 1=1 and s.devName=? and s.devVer=? and s.devSupplierId=?";
		return getSession().createQuery(hql).setParameter(0, detail.getDevName())
				.setParameter(1, detail.getDevVer()).setParameter(2,detail.getDevSupplierId()).list();
	}

}
